package com.bjesc_b2c.app.appraiset.utils;

import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.WindowManager;
import android.widget.PopupWindow;

import com.bjesc_b2c.app.appraiset.R;


/**
 * Created by 陈志坚 on 2016/11/7.
 */

public class PopupWindowScreenBrightnessUtils {
    public static void setBrightness(Context mContext ,PopupWindow pop){
        ColorDrawable dw = new ColorDrawable(mContext.getResources().getColor(
                R.color.color00000000));
        WindowManager.LayoutParams lp = ((Activity)mContext).getWindow().getAttributes();
        lp.alpha = 0.7f;
        ((Activity)mContext).getWindow().setAttributes(lp);
        // 设置SelectPicPopupWindow弹出窗体的背景
        pop.setBackgroundDrawable(dw);
    }

    public static void setRecovery(Context mContext ,PopupWindow pop){
        ColorDrawable dw = new ColorDrawable(mContext.getResources().getColor(
                R.color.color00000000));
        WindowManager.LayoutParams lp = ((Activity)mContext).getWindow().getAttributes();
        lp.alpha = 1f;
        ((Activity)mContext).getWindow().setAttributes(lp);
        // 设置SelectPicPopupWindow弹出窗体的背景
        pop.setBackgroundDrawable(dw);
    }
}
